<?php

namespace App\Models\Category;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CategoryGroup extends Model
{
    use HasFactory;
    use SoftDeletes;

    /**
     * The attributes that are mass assignable.
     * 可批量分配的属性。
     * @var array
     */
    protected $fillable = [
        'title', 'name', 'depth', 'is_show'
    ];

    /**
     * 关联的分类
     */
    public function category()
    {
        return $this->hasMany(Category::class,'category_group_id','id');
    }
}
